package com.ruowei.modules.sys.utils;

import org.apache.commons.math3.random.RandomDataGenerator;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public final class LSQ405Util {

    public static String genRequest(String AcctNbr, String StartDt, String TmntDt, String CurPg) {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter dateDTF = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        RandomDataGenerator randomDataGenerator = new RandomDataGenerator();
        // @formatter:off
        String body =
                "<LSQReqHead>" +
                        "<CnlId>N6</CnlId>" +
                        "<CnlDt>" + dateDTF.format(now) + "</CnlDt>" +
                        "<CnlSeqNbr>" + randomDataGenerator.nextSecureLong(1000000000L, 9999999999L) + "</CnlSeqNbr>" +
                        "<TxCd>" + randomDataGenerator.nextSecureHexString(8) + "</TxCd>" +
                        "</LSQReqHead>" +
                        "<AcctNbr>" + AcctNbr + "</AcctNbr>" +
                        "<StartDt>" + StartDt + "</StartDt>" +
                        "<TmntDt>" + TmntDt + "</TmntDt>" +
                        "<DsplNbr>99</DsplNbr>" +
                        "<CurPg>" + CurPg + "</CurPg>";
        // @formatter:on
        return ESBUtil.genRequest("LSQ.0LSQ40500.01", body);
    }
}
